package com.tencent.sr.iris.basic.mp.dependency.poster;

import com.alibaba.fastjson.JSON;
import com.tencent.sr.iris.basic.service.interfaces.client.poster.InvitePosterClient;
import com.tencent.sr.iris.basic.service.interfaces.request.poster.QueryScenePosterRequest;
import com.tencent.sr.iris.basic.service.interfaces.response.poster.QueryAllSceneResponse;
import com.tencent.sr.iris.basic.service.interfaces.response.poster.QueryScenePosterResponse;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class InvitePosterDependency {

    @Resource
    private InvitePosterClient invitePosterClient;

    public HttpResult<List<QueryAllSceneResponse>> queryAllSceneList() {
        try {
            return invitePosterClient.queryAllSceneList();
        } catch (Exception e) {
            log.error("queryAllSceneList error", e);
            return HttpResult.fail(e.getMessage());
        }
    }

    public HttpResult<List<QueryScenePosterResponse>> queryScenePosterList(QueryScenePosterRequest request) {
        try {
            return invitePosterClient.queryScenePosterList(request);
        } catch (Exception e) {
            log.error("queryScenePosterList error,request:{}",JSON.toJSONString(request), e);
            return HttpResult.fail(e.getMessage());
        }
    }
}
